package ah.ddh.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class ConnectDB {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url ="jdbc:mysql://localhost/test";
			String userName = "root";
			String password = "1234";
			Connection conn = DriverManager.getConnection(url, userName, password);
			String sql = "select * from a1";
			Statement stmt = conn.createStatement();
			ResultSet rs = stmt.executeQuery(sql);
			while (rs.next()) {
				System.out.println(rs.getString(2));
				System.out.println(rs.getDate(3));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
